package com.car.dal.dao.goods;

import com.car.bean.GridObj;
import com.car.bean.OrderObj;
import com.car.bean.PageObj;
import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.TgGoodsAccount;
import com.car.dal.object.TgGoodsKey;
import com.car.util.Page;

import java.util.List;

public class TgGoodsKeyDaoImpl extends IbatisCommonDao<TgGoodsKey, Long> implements TgGoodsKeyDao {

    public GridObj GetList(TgGoodsKey tgGoodsKey, PageObj pageObj) {
        OrderObj order = new OrderObj();
        order.setDir("desc");
        order.setSort("id");
        return super.findByPage(tgGoodsKey, pageObj, order);
    }

    @Override
    public Integer getGoodsKeyCountInfo(TgGoodsKey tgGoodsKey) {
        return this.queryForInteger("getGoodsKeyCountInfo", tgGoodsKey);
    }


    public List<TgGoodsKey> getGoodsKeyInfo(TgGoodsKey tgGoodsKey, Page page) {
        tgGoodsKey.setFirstrownum(page.getFirstrownum());
        tgGoodsKey.setPagesize(page.getPagesize());
        List<TgGoodsKey> list = this.queryForEntityList(TgGoodsKey.class, "getGoodsKeyInfo", tgGoodsKey);
        return list;
    }
}
